//
//  activitylistTableViewCell.m
//  豆瓣电影app
//
//  Created by 洛洛大人 on 16/6/24.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "activitylistTableViewCell.h"
#import "activitylistModel.h"
@interface activitylistTableViewCell()

@property (nonatomic, retain) UILabel *begin_timeLabel;

@property (nonatomic, retain) UILabel *end_timeLabel;

@property (nonatomic, retain) UILabel *addressLabel;

@property (nonatomic, retain) UILabel *titleLabel;

@property (nonatomic, retain) UIImageView *ViewImage;

@property (nonatomic, retain) UILabel *category_nameLabel;

@property (nonatomic, retain) UILabel *wisher_countLabel;

@property (nonatomic, retain) UILabel *participant_countLabel;

@property (nonatomic, retain)UIImageView *leoImageView;

@property (nonatomic, retain)UIImageView *llImageView;

@property (nonatomic, retain)UIImageView *image1;

@property (nonatomic, retain)UIImageView *image2;

@property (nonatomic, retain)UIImageView *image3;

@property (nonatomic, retain)UILabel *combineLabel;



@end


@implementation activitylistTableViewCell

-(void)dealloc{
    [_begin_timeLabel release];
    [_end_timeLabel release];
    [_addressLabel release];
    [_titleLabel release];
    [_ViewImage release];
    [_category_nameLabel release];
    [_wisher_countLabel release];
    [_participant_countLabel release];
    [_leoImageView release];
    [_llImageView release];
    [_image1 release];
    [_image2 release];
    [_image3 release];
    [_combineLabel release];
    [super dealloc];
    
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.leoImageView =[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"bg_eventlistcell@2x.png"]];
        self.leoImageView.frame = CGRectMake(8, 10, self.contentView.frame.size.width + 60, self.contentView.frame.size.height * 3.7);
        
        self.llImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"bg_share_large@2x.png"]];
        self.llImageView.frame = CGRectMake(05, 40, self.leoImageView.frame.size.width - 10, self.leoImageView.frame.size.height * 0.7);
        
        self.image1= [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"icon_catalog.png"]];
        self.image1.frame = CGRectMake(10, 55, 15, 15);
        [self.llImageView addSubview:self.image1];

        self.image2= [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"icon_spot.png"]];
        self.image2.frame = CGRectMake(10, 30, 15, 15);
        [self.llImageView addSubview:self.image2];
        
        self.image3= [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"icon_date.png"]];
        self.image3.frame = CGRectMake(10, 5, 15, 15);
        [self.llImageView addSubview:self.image3];
        
        UILabel *label1 = [[UILabel alloc]init];
        label1.text = @"类型:";
        label1.frame = CGRectMake(30, 55, 40, 15);
        [self.llImageView addSubview:label1];
        
        UILabel *label2 = [[UILabel alloc]init];
        label2.text = @"感兴趣:";
        label2.frame = CGRectMake(15, 90, 100, 15);
        [self.llImageView addSubview:label2];
        
        UILabel *label3 = [[UILabel alloc]init];
        label3.text = @"参加:";
        label3.frame = CGRectMake(140, 90, 100, 15);
        [self.llImageView addSubview:label3];
      
                
        [self.leoImageView addSubview:self.llImageView];
        [self.contentView addSubview:self.leoImageView];
        
         self.titleLabel = [[UILabel alloc] init];
        [self.leoImageView  addSubview:self.titleLabel];
        [self.titleLabel release];
        
        self.ViewImage = [[UIImageView alloc]init];
        [self.leoImageView  addSubview:self.ViewImage];
        [self.ViewImage release];
        
        self.begin_timeLabel = [[UILabel alloc]init];
        self.end_timeLabel = [[UILabel alloc]init];

        [self.begin_timeLabel release];
        [self.end_timeLabel release];
        
        self.combineLabel = [[UILabel alloc]init];
        [self.leoImageView addSubview:self.combineLabel];
        [self.combineLabel release];
        
      
        self.addressLabel = [[UILabel alloc]init];
        [self.llImageView  addSubview:self.addressLabel];
        [self.addressLabel release];

        
        self.category_nameLabel = [[UILabel alloc]init];
        [self.llImageView addSubview:self.category_nameLabel];
        [self.category_nameLabel release];
        
        self.wisher_countLabel = [[UILabel alloc]init];
        [self.llImageView  addSubview:self.wisher_countLabel];
        [self.wisher_countLabel release];
        
        self.participant_countLabel = [[UILabel alloc]init];
        [self.llImageView  addSubview:self.participant_countLabel];
        [self.participant_countLabel release];
        
        
        
    }
    return self;
}

-(void)layoutSubviews{
    
    [super layoutSubviews];
    self.ViewImage.frame =CGRectMake(300, 50, 70,100);

    self.titleLabel.frame = CGRectMake(10, 5, 370, 30);
    
    self.combineLabel.frame = CGRectMake(35, 28, 270, 50);
    
    self.addressLabel.frame =CGRectMake(30, 12, 250, 50);

    self.category_nameLabel.frame =CGRectMake(80, 55, 40,15);
    self.wisher_countLabel.frame =CGRectMake(75, 72, 50,50);
    self.participant_countLabel.frame =CGRectMake(180, 72, 50,50);

}



-(void)setModel:(activitylistModel *)model{
    if(_model != model) {
        [_model release];
        _model = [model retain];
    }
    
    NSURL *url = [NSURL URLWithString:model.image];
    NSData *data = [NSData dataWithContentsOfURL:url];
    
    
    self.ViewImage.image = [UIImage imageWithData:data];
    

    self.begin_timeLabel.text = model.begin_time;
    self.end_timeLabel.text = model.end_time;
    self.combineLabel.text = [NSString stringWithFormat:@"%@--%@", [_begin_timeLabel.text substringFromIndex:5],[_end_timeLabel.text substringFromIndex:5]];
   


   
    self.addressLabel.text = model.address;
    self.titleLabel.text = model.title;
    self.category_nameLabel.text = model.category_name;
    self.wisher_countLabel.text = [NSString stringWithFormat:@"%@", model.wisher_count];
    self.participant_countLabel.text = [NSString stringWithFormat:@"%@", model.participant_count];
    
   

    
}













@end
